<template>
  <el-aside class="container-aside">
    <el-menu :default-active="activeIndex" :router="true"  class="el-menu-vertical-demo container-sidebar" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b">
      <el-menu-item index="overview">
        <i class="el-icon-menu"></i>
        <span slot="title">库存总览</span>
      </el-menu-item>
      <el-submenu :disabled="!ifAdmin" index="">
        <template slot="title">
          <i class="el-icon-setting"></i>
          <span>后台管理</span>
        </template>
        <el-menu-item index="init-stock"><i class="el-icon-tickets"></i>库存管理</el-menu-item>
        <el-menu-item index="usermanage"><i class="el-icon-tickets"></i>人员管理</el-menu-item>
      </el-submenu>
    </el-menu>
  </el-aside>
</template>

<script>
  import {getUserinfo} from '../utils'

  export default {
    name: "sidebar",
    data() {
        return {
          ifAdmin: true,
        };
    },
    props: ['activeIndex'],
    methods: {},
    computed: {},
    components: {},
    created(){
      console.log(getUserinfo());
      this.ifAdmin = getUserinfo().is_admin;
    }

  }
</script>

<style scoped>

</style>
